import { defineStore } from 'pinia';
import * as dataTypes from '@/api/data';
import * as userApi from '@/api/user';

interface sytemState {
  list: dataTypes.SystemUser[];
  projectList: any;
}

export default defineStore<string, sytemState>('user', {
  // namespaced: true,
  state: () => ({
    list: [],
    // 用户项目列表
    projectList: [],
  }),
  actions: {
    // 登陆
    async updatelogin(data: object) {
      const res = await userApi.login(data);
      this.list = res;
    },
    // 用户项目列表
    async updateprojectList(data: any) {
      const res = await userApi.getprojectList(data);
      this.projectList.push(res);
    },

  },
});
